# Contributor: Russ Webber <russ@rw.id.au>
# Maintainer: Russ Webber <russ@rw.id.au>
pkgname=vcstool
pkgver=0.2.9
pkgrel=0
pkgdesc="A command line tool designed to make working with multiple repositories easier"
url="https://github.com/dirk-thomas/vcstool"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-yaml"
makedepends="py3-setuptools"
checkdepends="py3-pytest py3-flake8 py3-pydocstyle py3-flake8-import-order subversion mercurial git"
subpackages="$pkgname-bash-completion:bashcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-tcsh-completion:tcshcomp:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/dirk-thomas/vcstool/archive/$pkgver.tar.gz
	pr146.patch::https://github.com/dirk-thomas/vcstool/commit/bd71528e0f9244e9ca1f409b859f10dea2ad3cda.patch"  # can be removed in next version when merged

build() {
	python3 setup.py build
}

check() {
	PYTHONPATH="$builddir/build" pytest -s -v test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"

	mkdir -p "$pkgdir"/usr/share/bash-completion/completions
	mkdir -p "$pkgdir"/usr/share/zsh/site-functions
	mkdir -p "$pkgdir"/usr/share/tcsh-completion/completions
	mv "$pkgdir"/usr/share/vcstool-completion/vcs.bash "$pkgdir"/usr/share/bash-completion/completions
	mv "$pkgdir"/usr/share/vcstool-completion/vcs.zsh "$pkgdir"/usr/share/zsh/site-functions
	mv "$pkgdir"/usr/share/vcstool-completion/vcs.tcsh "$pkgdir"/usr/share/tcsh-completion/completions
	rm -rf "$pkgdir"/usr/share/vcstool-completion
}

tcshcomp() {
	pkgdesc="tcsh completions for $pkgname"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel tcsh"

	amove /usr/share/tcsh-completion/completions
}

sha512sums="d243360402d695385d36a3a325075a9524f4f771e84a0c013d39e08d25c4114740a4c6135a395771e795ec5fc23118422afd305159841c4dedfe4b50ddad1aa4  vcstool-0.2.9.tar.gz
b8911b638437995ef5e52e8ae7d6d4eb468fe52e6a36d58201394f118c8301af09c102cb06d7ec72640099cbef65036933948b3930be21c6eeadcc7c38963403  pr146.patch"
